<?php
/**
 * 翻滚吧！舰娘√没有舰男版的萌化插件
 * 
 * @package 翻滚吧！舰娘 
 * @author 昌浩
 * @version 1.0.0
 * @link http://www.ibl.me
 */
class Kankour_Plugin implements Typecho_Plugin_Interface
{
    /**
     * 激活插件方法,如果激活失败,直接抛出异常
     * 
     * @access public
     * @return void
     * @throws Typecho_Plugin_Exception
     */
    public static function activate()
    {
        Typecho_Plugin::factory('Widget_Archive')->header = array('Kankour_Plugin', 'header');
        Typecho_Plugin::factory('Widget_Archive')->footer = array('Kankour_Plugin', 'footer');
    }
    
    /**
     * 禁用插件方法,如果禁用失败,直接抛出异常
     * 
     * @static
     * @access public
     * @return void
     * @throws Typecho_Plugin_Exception
     */
    public static function deactivate(){}
    
       /**
     * 获取插件配置面板
     * 
     * @access public
     * @param Typecho_Widget_Helper_Form $form 配置面板
     * @return void
     */
    public static function config(Typecho_Widget_Helper_Form $form){
        $kanlink = new Typecho_Widget_Helper_Form_Element_Text('kanlink', NULL, 'http://www.kuroko.us/', _t('点击舰娘跳转的网址。。'));
        $form->addInput($kanlink);
        $copyright = new Typecho_Widget_Helper_Form_Element_Textarea('copyright', NULL, '颗粒clear © 2014 All Rights Reserved. / ©http://www.ibl.me Ctrl+D收藏本站', _t('左下角海水版权。。'));
        $form->addInput($copyright);
    }
    
    /**
     * 个人用户的配置面板
     * 
     * @access public
     * @param Typecho_Widget_Helper_Form $form
     * @return void
     */
    public static function personalConfig(Typecho_Widget_Helper_Form $form){}

    /**
     * 输出头部css
     * 
     * @access public
     * @return void
     */
    public static function header(){
        $cssUrl = Helper::options()->pluginUrl . '/Kankour/Kankour.css';
        echo '<link rel="stylesheet" type="text/css" href="' . $cssUrl . '" />' . "\n";
    }
    /**
     * 输出底部
     * 
     * @access public
     * @return void
     */
    public static function footer(){
        $options = Typecho_Widget::widget('Widget_Options')->plugin('Kankour'); 
        $jsUrl = Helper::options()->pluginUrl . '/Kankour/Kankour.js';
        $imgUrl = Helper::options()->pluginUrl . '/Kankour/img/';
        echo '<div class="kankore-bath"> <div class="water" style="animation: 10s linear 0s normal none infinite waves-l2r;"> <div class="copyright">'.$options->copyright.'</div> </div> <div class="akagi kan" href="'.$options->kanlink.'"> <img src="'.$imgUrl.'kankore-bath-akagi.png"> </div> <div class="shimakaze kan" href="'.$options->kanlink.'"> <img src="'.$imgUrl.'kankore-bath-shimakaze.png"> </div> <div class="ryujo kan floating" href="'.$options->kanlink.'"> <img src="'.$imgUrl.'kankore-bath-ryujo.png"> </div> <div class="kitakami kan floating" href="'.$options->kanlink.'"> <img src="'.$imgUrl.'kankore-bath-kitakami.png"> </div></div>' . "\n";
        echo '<script src="http://libs.baidu.com/jquery/1.8.0/jquery.min.js"></script>' . "\n";
        echo '<script type="text/javascript" src="'.$jsUrl.'"></script>' . "\n";
    }

}